//
//  YLMoreIntegralHeaderView.m
//  YLFinanceService
//
//  Created by she1323 on 2017/9/19.
//  Copyright © 2017年 she1323. All rights reserved.
//  获得更多积分

#import "YLMoreIntegralHeaderView.h"
#import <Masonry.h>
#import "YLGlobeHeader.h"

@interface YLMoreIntegralHeaderView ()
@property (nonatomic, weak) UILabel *titleLabel;
@property (nonatomic, weak) UIImageView *icon;
@end


@implementation YLMoreIntegralHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI
{
    __weak typeof(self) weakSelf = self;
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = [UIFont systemFontOfSize:13.0f];
    _titleLabel = titleLabel;
    titleLabel.textColor =YLLOrgColor;
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(weakSelf).mas_offset(-5);
        make.left.mas_equalTo(weakSelf).mas_offset(40);
    }];
    
    UIImageView *icon = [[UIImageView alloc] init];
    _icon = icon;
    [self addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakSelf).mas_offset(10);
        make.bottom.mas_equalTo(titleLabel);
        make.right.mas_equalTo(titleLabel.mas_left).mas_offset(-7);
        make.height.mas_equalTo(icon.mas_width);
    }];
    
}

- (void)setTitle:(NSString *)title
{
    _title = title;
    _titleLabel.text = title;
}

- (void)setIconName:(NSString *)iconName
{
    _iconName = iconName;
    _icon.image = [UIImage imageNamed:iconName];
}
@end
